class Solution
{
public:
    vector<int> distinctDifferenceArray(vector<int> &nums)
    {
        int n = nums.size();
        vector<int> result(n);
        for (int i = 0; i < n; ++i)
        {
            result[i] = set<int>(nums.begin(), nums.begin() + i + 1).size() - set<int>(nums.begin() + i + 1, nums.end()).size();
        }
        return result;
    }
};